<?php 
defined('RUN_KATANA') or die('Restricted access');
$mod = new Module($katana, 1);

$buttons[0]['title'] = ucfirst($txt->getWord('login'));
$buttons[0]['href'] = '';
$buttons[0]['onclick'] = 'document.getElementById(\'mod_login_user_'.$mod->Id.'\').submit();';
$buttons[0]['params']['class'] = 'btn btn-primary';

$buttons[1]['title'] = ucfirst($txt->getWord('forgot_password'));
$buttons[1]['href'] = '';
$buttons[1]['onclick'] = 'document.getElementById(\'forgot_password_div_'.$mod->Id.'\').style.display=\'block\';';
$buttons[1]['params']['class'] = 'btn btn-default';

$mod->setButtonsContent($buttons);
unset($buttons);
?>
<?php if(!($_SESSION['userid'] > 0)): ?>
<form id="mod_login_user_<?php echo $mod->Id; ?>" action="<?php echo $katana->getFormAction(); ?>" method="post" enctype="multipart/form-data" name="login_user" role="form">
	<p>
    	Innlogging for eksisterende kunder.<br />
		Dersom du er ny kunde, vennligst klikk p&aring; det produktet du &oslash;nsker &aring; bestille.
    </p>
    <div class="form-group">
        <label for="username1"><?php echo ucfirst($txt->getWord('e-mail')); ?></label>
        <input id="username1" name="username" type="email" class="form-control" id="exampleInputEmail1" value="<?php echo $_REQUEST['username']; ?>" placeholder="<?php echo ucfirst($txt->getWord('e-mail')); ?>" maxlength="30">
        <?php 
			if($user->Error['username'])
			{ echo '<span class="error">'.ucfirst($user->Error['username']).'</span>'; }
			if($user->Info['username'])
			{ echo '<span class="info">'.ucfirst($user->Info['username']).'</span>'; }
		?>
    </div>
    <div class="form-group">
        <label for="password1"><?php echo ucfirst($txt->getWord('password')); ?></label>
        <input id="password1" type="password" class="form-control" placeholder="<?php echo ucfirst($txt->getWord('password')); ?>">
        <?php 
			if($user->Error['password'])
			{ echo '<span class="error">'.ucfirst($user->Error['password']).'</span>'; }
			if($user->Info['info'])
			{ echo '<span class="info">'.ucfirst($user->Info['password']).'</span>'; }
		?>
    </div>
    <?php echo getButtonsHTML($theme->HFBSets[$theme->ComHFB]['button'], $mod->getButtonsContent()); ?>
    <input type="hidden" name="action" value="login_user" />
</form>
<div id="forgot_password_div_<?php echo $mod->Id; ?>" <?php if($_REQUEST['formname'] != $mod->Id.'_mod_forgot_password_form') echo 'style="display:none;"'; ?>><br />
<form id="mod_forgot_password_form_<?php echo $mod->Id; ?>" action="<?php echo $katana->getFormAction(); ?>" method="post" enctype="multipart/form-data" name="forgot_password">
	<h3><?php echo ucfirst($txt->getWord('forgot_password')); ?></h3>
    <label for="username_email1"><?php echo ucfirst($txt->getWord('type_in').' '.$txt->getWord('username').' '.$txt->getWord('or').' '.$txt->getWord('e-mail')); ?></label>
    <?php 
        if($user->Error['username_email'])
        { echo '<br /><span class="error">'.ucfirst($user->Error['username_email']).'</span>'; }
        if($user->Info['username_email'])
        { echo '<br /><span class="info">'.ucfirst($user->Info['username_email']).'</span>'; }
    ?>
    <input id="username_email1" name="username_email" type="text" value="<?php echo $_REQUEST['username_email']; ?>" maxlength="30" />
    <input type="hidden" name="action" value="reset_password" />
    <input type="hidden" name="formname" value="<?php echo $mod->Id; ?>_mod_forgot_password_form" />
    <button type="submit" class="btn btn-default"><?php echo ucfirst($txt->getWord('send')); ?></button>
</form>
</div>
<?php endif; ?>